﻿using Bricks.Business.Data.Repositories.Account;
using Bricks.Business.Models.Account;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;

namespace Bricks.Business.Service.Impl
{
    [Export(typeof(IMenuActionService))]
    public class MenuActionService : IMenuActionService
    {
        #region 保护属性
        [Import]
        protected IMenuActionRepository MenuActionRepository { get; set; }
        #endregion

        #region 公共属性
        public IQueryable<MenuAction> MenuActions
        {
            get { return MenuActionRepository.Entities; }
        }
        #endregion

        #region 公共属性
        /// <summary>
        /// 根据ID获取MenuAction记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public MenuAction GetMenuActionByID(Guid id)
        {
            MenuAction result = null;
            result = MenuActions.FirstOrDefault(m => m.ID == id);
            return result;
        }
        #endregion
    }
}
